from PIL import Image, ImageDraw
from PIL import Image, ImageFilter
from PIL import ImageFont, ImageDraw,Image, ImageDraw
#1.图片划线
'''
im = Image.open("python.jpg")
draw = ImageDraw.Draw(im)
draw.line((0, 0) + im.size, fill=128)
draw.line((0, im.size[1], im.size[0], 0), fill=128)
del draw
# write to stdout
im.save("blur.jpg", "PNG")
'''
#2.图片加图片水印
'''
image = Image.open("python.jpg")
logo = Image.open("logo.png")
layer = Image.new('RGBA', image.size, (0, 0, 0, 0))
layer.paste(logo, (50, 60))
out = Image.composite(layer, image, layer)
out.save("imageWithLogo.png", "png")
out.show()
'''
#3.图片模糊
'''
# 打开一个jpg图像文件，直接放到当前路径下方便点:
im = Image.open('python.jpg')
# 应用模糊滤镜:
im2 = im.filter(ImageFilter.BLUR)
im3 = im2.convert('RGB')
im3.save('blur1.jpg')
'''
#4.图片截取
'''
img = Image.open("python.jpg")
print(img.size)
cropped = img.crop((0, 0, 1303, 734))  # (left, upper, right, lower)
cropped.save("imageCropped.png")
'''